package com.situ.boot.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Hello2Controller {

    //配置文件中的信息都会被扫描注入到Spring容器中
    //可以通过@Value注解将配置文件中的值映射到一个Spring管理的Bean的字段上
    @Value("${name}")
    private String name;

    @Value("${person.address}")
    private String address;

    @RequestMapping(value = "/hello2")
    @ResponseBody
    public String hello2() {
        return  "name: " + name + ", address: " + address;
    }
}
